package com.lizard.schedule.utils;

import java.util.regex.Pattern;

/**
 * 正则表达式相关工具类
 */
public class RegexUtil {

    /**
     * 用户名只能包含数字、字母、"_"、"@"、"."、"-"
     *
     * @param username
     * @return
     */
    public static boolean checkUsername(String username){
        boolean flag = false;
        if(Pattern.matches("[A-Za-z0-9_@.-]*", username)){
            flag = true;
        }
        return flag;
    }

    /**
     * 密码只能包含数字、字母、下划线
     *
     * @param username
     * @return
     */
    public static boolean checkPassword(String username){
        boolean flag = false;
        if(Pattern.matches("[A-Za-z0-9_]*", username)){
            flag = true;
        }
        return flag;
    }

}
